c5f061014f8042274f3ee0f14daee43254f279ed,enterprise/main/java/org/neo4j/index/impl/lucene/FullTxData.java,FullTxData,searcher,#,166

Before Change


    
    private IndexSearcher searcher()
    {
        try
        {
            if ( this.searcher == null )
            {
                this.writer.commit();
                this.searcher = new IndexSearcher( directory, true );
            }
        }

After Change


    
    private IndexSearcher searcher()
    {
        if ( this.searcher != null && !modified )
        {
            return this.searcher;
        }
        
        try
        {
            IndexReader newReader = this.reader == null ? this.writer.getReader() : this.reader.reopen();
            if ( newReader == this.reader )
            {
                return this.searcher;
            }
            if ( this.reader != null )
            {
                this.reader.close();
            }
            this.reader = newReader;
            if ( this.searcher != null )
            {
                this.searcher.close();
            }
            searcher = new IndexSearcher( reader );
        }